
import java.util.ArrayList;
import java.util.List;

/**
 * @author <a href="mailto:sjj@jianzhimao.com">mojo</a>
 * copyright (C), 2013-2022, 广州九尾信息科技有限公司
 * @date 2022/1/15 15:15
 */
public class GenericA<E> {
    private E arg1;
    private E arg2;

    public E getArg1() {
        return arg1;
    }

    public void setArg1(E arg1) {
        this.arg1 = arg1;
    }

    public E getArg2() {
        return arg2;
    }

    public void setArg2(E arg2) {
        this.arg2 = arg2;
    }

    public <T> T genericMethod(Class<T> zlass) {

        return null;
    }

    //静态泛型，需要额外声明泛型
    public static <A> void m(Class<? extends A> zlass) {

    }


    public static void main(String[] args) {
        GenericA<String> a = new GenericA<>();
        Class<? extends GenericA> aClass = a.getClass();
        //不能newInstance实例化类型变量
        //GenericA genericA1 = a.getClass().newInstance();
        GenericA<String> genericA = a;
        genericA.setArg1("1");
        System.out.println(genericA.getArg1());
        if (a instanceof GenericA) {
            System.out.println(">>>");
        } else {
            System.out.println("<<<");
        }
        List<String>[] ls = new ArrayList[10];
        String[] strings = new String[10];
        Object[] objects = strings;
        objects[7] = 11;
        System.out.println(objects[7]);
    }
}
